#delimit;
version 11;
set linesize 80;
set more off;

use "~/Dropbox/Documents/Papers/Race_for_Regs/Dataverse/Race_for_regs_REGS.dta", clear;

stset edate, origin(firstdate) id(rin) failure(last);

/******************************************************************************/
/* Table 3 */
stcox unif2 statutorydeadline,nohr;
stcox unif2 over statutorydeadline judicialdeadline rfa smallbusiness smallgovt legalauthoritynumber
	obama clinton realyear i.agency_code,nohr ;
stcox unif2 over iunif2over statutorydeadline judicialdeadline rfa iunif2stat smallbusiness smallgovt legalauthoritynumber
	obama clinton realyear i.agency_code , nohr ;
/******************************************************************************/

	
	
	
/******************************************************************************/
/* Figure 1 */
set scheme s2mono; 

stcox unif2 over statutorydeadline judicialdeadline rfa smallbusiness smallgovt legalauthoritynumber
	obama clinton if realyear>=1997,nohr basesurv(surv0);
gen survDG=surv0^exp(1.47*0+.001*10+.248+1+.288*0+.051*0-.065*1+.269*0+.015*5+.322*0 + .168*0);
gen survUG=surv0^exp(1.47*1+.001*10+.248+1+.288*0+.051*0-.065*1+.269*0+.015*5+.322*0 + .168*0);
label var survDG "Proposed or Adopted under Divided Government";
label var survUG "Proposed and Adopted under Unified Government";
label var _t "Days from Regulation Proposal"; 
drop if _t>2100;
line survDG survUG _t, sort ylab(0 .1 to 1) xlab(0 400 to 2000) xscale(range(0 2000) noextend) 
	legend(cols(1)) saving(DGUGhazards, replace);
graph export  "~/Dropbox/Apps/sharelatex/MM-raceforregs/DGUGhazards.pdf", replace;
/******************************************************************************/

